﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using WebSEClassLibrary;

namespace WebSE
{
    public partial class Act3_3 : System.Web.UI.Page
    {
        private ActPage actPage;

        protected void Page_Load(object sender, EventArgs e)
        {
            actPage = (ActPage)Session["currentPage"];
            problem.Text = actPage.Problem;

            //设置用户答案
            if (actPage.UserChsAns == null) return;
            blank1.Text = actPage.UserFillAns[0];
            blank2.Text = actPage.UserFillAns[1];
            blank3.Text = actPage.UserFillAns[2];
        }

        protected void submit(object sender, EventArgs e)
        {
            if (blank1.Text == "" || blank2.Text == "" || blank3.Text == "")
                explain.Text = "请输入答案";
            else
            {
                actPage.UserFillAns[0] = blank1.Text;
                actPage.UserFillAns[1] = blank2.Text;
                actPage.UserFillAns[2] = blank3.Text;

                int i;
                explain.Text = "1. ";
                for (i = 0; i < actPage.CountSimilar[0]; i++)
                {
                    if (i > 0) explain.Text += "/";
                    explain.Text += actPage.FillAns[0][i];
                }
                explain.Text += "<br/>2. ";
                for (i = 0; i < actPage.CountSimilar[1]; i++)
                {
                    if (i > 0) explain.Text += "/";
                    explain.Text += actPage.FillAns[1][i];
                }
                explain.Text += "<br/>3. ";
                for (i = 0; i < actPage.CountSimilar[2]; i++)
                {
                    if (i > 0) explain.Text += "/";
                    explain.Text += actPage.FillAns[2][i];
                }
                explain.Text += actPage.ExplainFill;
            }
        }
    }
}
